<style>
.typeitem{	
	text-align:left;
	padding:0.5rem;
	background:#fff;
	background: var(--s-color-bg-primary,#fff);
    border: 1px solid rgba(0,0,0,.08);
    border: 1px solid var(--s-color-border-tertiary,rgba(0,0,0,.08));
}
.typeitem.active{
    border: 1px solid {{main.syscolor || '#7c1cc9'}};
}
</style>
<div class="fui-cell-group radius">
	<div ng-repeat="item in pagedata.list" class="fui-cell" style="padding:0.35rem;">
		<div ng-click="pagedata.delagent(item.id)" style="position: absolute;top:0;right:0.5rem">
			<i class="icon icon-jian bold red"></i>
		</div>
		<div ng-click="access_json('/goodsitem//id='+item.id);" class="fui-cell-lable" style="width:auto;padding-right: 0.3rem;">
			<img style="border-radius: 100%;width:3.3rem;height:3.3rem" ng-src="{{tomedia(item.agent.logo) || '../addons/jy_aiagent/resource/images/nv1.png'}}" />
		</div>
		<div ng-click="access_json('/goodsitem//id='+item.id);" class="fui-cell-text" style="">
			<div class="bold">{{item.title||'设备名称'}}</div>
			<div ng-if="pagedata.pluginset.showinfo>=1" class="gray">智能体：{{item.agent.title||'默认智能体'}}</div>
			<div ng-if="pagedata.pluginset.showinfo>=2" class="gray overflow-h">音色：{{item.agent.voice.title}}</div>
			<div ng-if="pagedata.pluginset.showinfo>=3" class="gray overflow-h">模型：{{item.agent.llm_modeltitle}}</div>
		</div>
		<div class="fui-cell-remark noremark" style="padding-left:0;width:4rem;padding-top: 0.5rem;">
			<div ng-if="!item.deviceid || item.deviceid==0" class="btn btn-sm btn-success jy-btn1" ng-click="pagedata.showpeigoodscode=true" style="color:#7783EA;border-radius:0.2rem">绑定配码</div>
			<div ng-if="item.deviceid>0" class="btn btn-sm btn-success jy-btn1" ng-click="access_json('/goodsitem//id='+item.id);" style="color:#7783EA;border-radius:0.2rem">详情</div>
		</div>
	</div>
	<div ng-if="pagedata.list.length > 0" style="padding-bottom: 0.5rem;">
		<div class="c">
			<div class="weui_btn_area" style="margin-top:0">
				<a class="weui_btn weui_btn_primary jy-btn1" style="line-height:3;color:#7783EA;border-radius:1.3rem" id="showTooltips" ng-click="pagedata.show2lanya=true"><i class="icon icon-qiehuan"></i> 给设备重新配WIFI账户</a>
			</div>
		</div>
	</div>
	<div class="content-empty" ng-show="!pagedata.list || pagedata.list.length == 0 ">
		<img style="border-radius: 100%;width:2rem;height:2rem" src="../addons/jy_aiagent/resource/images/goods.png" />
		<div style="padding-top:0.3rem;color: #999;font-size: .75rem">您暂时没有添加设备</div>
	</div>
</div>
<div ng-if="pagedata.showpeigoodscode" class="popup">
	<div class="popup-body">
		<div class="popup-center radius" style="width: 80%;">
		<div class="fui-cell-group" style="margin-top:1rem;-webkit-overflow-scrolling: touch;">
		<div class="c bold">绑定配码</div>
		<div class="fui-cell">
		<div class="fui-cell-text c">
			<input type="text" class='fui-input' style="margin-left:0;background: #f2f2f2;" placeholder="请输入设备播报的6位数验证码" ng-model="pagedata.post.code"/>
		</div>
		</div>
		</div>
		<div class="fui-cellone" style="padding-top:0.5rem">
					<div class="fui-cellone-text" style="padding-right:0.5rem">
					<div class="radius c jy-btn1" ng-click="pagedata.showpeigoodscode=false" style="color:#7783EA;padding:0.5rem">
						取消
					</div>
					</div>	
					<div class="fui-cellone-text">
					<div class="radius c jy-btn2" ng-click="pagedata.peigoodscode()" style="color:#fff;padding:0.5rem">
						确定
					</div>
					</div>	
		</div>
		</div>
	</div>
</div>
<div ng-if="pagedata.showgoodslist" class="popup">
	<div class="popup-body">
		<div class="popup-bottom radius">
		<i class="closed icon icon-cuowu" ng-click="pagedata.showgoodslist=false"></i>
		<div class="fui-cell-group radius" style="margin-top:1rem;-webkit-overflow-scrolling: touch;">
			<div ng-repeat="item in pagedata.nowgoodslist" class="fui-cell" style="padding:0.35rem;">
				<div class="fui-cell-text" style="">
					<div class="bold">{{item.goods.title}}</div>
					<div class="bold">{{item.alias||'设备名称'}}</div>
					<div class="gray">Mac地 址：{{item.macsn||'***.***.***.***'}}</div>
					<div class="gray">固件版本：{{item.gu_v||'1.7.2'}}</div>
				</div>
				<div class="fui-cell-remark noremark" style="padding-left:0;width:4rem">
					<div ng-click="pagedata.delgoods(item.id)" class="btn btn-sm btn-success" style="background: #eaeef9;color:#7783EA;border-radius:0.2rem">删除</div>
				</div>
			</div>
			<div class="content-empty" ng-show="!pagedata.nowgoodslist || pagedata.nowgoodslist.length == 0 ">
				<img style="border-radius: 100%;width:2rem;height:2rem" src="../addons/jy_aiagent/resource/images/goods.png" />
				<div style="padding-top:0.3rem;color: #999;font-size: .75rem">您暂时没有设备</div>
			</div>
			<div class="fui-cellone" style="padding-top:0.5rem;padding-bottom:0">
					<div class="fui-cellone-text c">
						<div class="radius c" ng-click="pagedata.showpeigoodscode=true;pagedata.showgoodslist=false" style="background:#3263fe;color:#fff;padding:0.5rem">
							配置新设备
						</div>
					</div>	
			</div>
		</div>
		</div>
	</div>
</div>
<script>
scope.tool.get_list('jy_aiagent/index/getmygoods/',true);
scope.pagedata.scroll_bottom=function(){
		scope.tool.get_list('jy_aiagent/index/getmygoods/');
}
scope.pagedata.peigoodscode=function(){
   scope.post_json('jy_aiagent/index/peigoodscode/',scope.pagedata.post);
} 
scope.pagedata.delgoods=function(id){
	scope.confirm({
		'message':'确认要删除设备吗？删除后将无法找回！得重新添加！',
		'success':function(){
			scope.post_json('jy_aiagent/index/delgoodscode/',{'id':id});
		},
		'fail':function(){}
	});
}
</script>